/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2025-08-06 09:40:09
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2025-10-09 20:40:43
 * @FilePath: \work-tool\my-dev-project\src\router\index.tsx
 * @Description: 路由配置
 */
import { createBrowserRouter, Navigate } from "react-router-dom"

import Home from "@/views/home"
import Test from "@/views/test"
import NotFoundPage from "@/views/404/notFound"
import Login from "@/views/login/index"
import Layout from "@/layout/index"

// 控制台模块
import Dashboard from "@/views/dashboard"

// 系统管理模块
import UserManagement from "@/views/system/user"
import MenuManagement from "@/views/system/menu"
import RoleManagement from "@/views/system/role"
import DepartmentManagement from "@/views/system/department"

// 订单管理模块
import OrderList from "@/views/order/list"
import OrderAggregate from "@/views/order/aggregate"
import OrderTrack from "@/views/order/track"

const routes = [
    { path: '/', element: <Navigate to="/dashboard" /> },
    { path: '/login', element: <Login /> },
    {
        element: <Layout />,
        children: [
            { path: '/home', element: <Home /> },
            { path: '/dashboard', element: <Dashboard /> },
            // 系统管理模块
            { path: '/system/user', element: <UserManagement /> },
            { path: '/system/menu', element: <MenuManagement /> },
            { path: '/system/role', element: <RoleManagement /> },
            { path: '/system/dept', element: <DepartmentManagement /> },
            // 订单管理模块
            { path: '/order/list', element: <OrderList /> },
            { path: '/order/aggregate', element: <OrderAggregate /> },
            { path: '/order/track', element: <OrderTrack /> },
            // 示例模块
            { path: '/example', element: <Test /> },
        ]
    },
    { path: '/test', element: <Test /> },
    { path: '*', element: <Navigate to='/404' /> },
    { path: '/404', element: <NotFoundPage /> },
]

const router = createBrowserRouter(routes)

export default router
